$(function () {
  var colorList = ['#fd0000', '#e900ff', '#fea500']

  option = {
    title: {
      text: '报警比例',
      x: 'center',
      y: '43%',
      textStyle: {
        fontSize: 14,
        color: '#fff'
      }
    },
    tooltip: {
      trigger: 'item'
    },
    series: [
      {
        type: 'pie',
        center: ['50%', '50%'],
        radius: ['50%', '65%'],

        clockwise: true,
        avoidLabelOverlap: true,
        hoverOffset: 3,
        itemStyle: {
          normal: {
            color: function (params) {
              return colorList[params.dataIndex]
            }
          }
        },
        label: {
          show: true,
          position: 'outside',
          formatter: '{d}%',
          fontSize: 16
        },
        labelLine: {
          normal: {
            length: 10,
            length2: 5,
            lineStyle: {
              width: 1
            }
          }
        },
        data: [
          {
            name: '今日火警',
            value: 1
          },
          {
            name: '今日故障',
            value: 7
          },
          {
            name: '其他',
            value: 15
          }
        ]
      }
    ]
  }
  var myecharts = echarts.init($('.alarmStatis .pie')[0])
  myecharts.setOption(option)
})
